﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PBOffice.BLL;
using PBOffice.Model;

namespace Web
{
    public partial class Login : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnLogin_Click1(object sender, EventArgs e)
        {
            LoginManager loginman=new LoginManager();            
            if (txtLogin.Value.Trim() != "" && txtPwd.Value.Trim() != "")
            {
                Staff sta = new Staff();
                sta.StfName = txtLogin.Value;
                sta.Password = txtPwd.Value;
                if (loginman.LoginIs(ref sta) && sta.Status == 1)
                {
                    Session["LoginStaff"] = sta;
                    Response.Redirect("index.aspx");
                }
                else
                {
                    Page.ClientScript.RegisterClientScriptBlock(typeof(string), "error", "alert('你不是我们的员工把！');", true);
 
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(string), "error", "alert('必须填写用户名和密码');", true);
            }

        }
    }
}